package com.glory.wxelectricitypda.base;

import android.app.Application;
import android.content.Context;

import com.pda.platform.ui.ui_pdaplatform.base.FreeUI_InitUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_SharePreferencesUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_StaticMembers;


/**
 * @author jaxhuang
 * @date 2017/9/15
 * @desc
 */

public class App extends Application {
    public static Context app;
    private static App instance;

    public static App getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        app = getApplicationContext();
//        FreeUI_InitUtils.init(getApplicationContext(), this, true);
        FreeUI_InitUtils.init(getApplicationContext(), this, false,90*1000L,0);
//        FreeUI_InitUtils.init(getApplicationContext(), this, false,10*1000L,0);
        FreeUI_InitUtils.setTheme(FreeApi_StaticMembers.THEME_SINGLE_SKY_BLUE);


        String ip = FreeApi_SharePreferencesUtils.getSharePre("URL_FILE", "URL_IP", getApplicationContext());
        if (ip.length() > 0) {
            Constant.REQUEST_URL = ip;
        } else {
            FreeApi_SharePreferencesUtils.setSharePre("URL_FILE", "URL_IP", Constant.REQUEST_URL, getApplicationContext());
        }

        String fileIP = FreeApi_SharePreferencesUtils.getSharePre("URL_FILE", "FILE_IP", getApplicationContext());
        if (fileIP.length() > 0) {
            Constant.FILE_URL = fileIP;
        } else {
            FreeApi_SharePreferencesUtils.setSharePre("URL_FILE", "FILE_IP", Constant.FILE_URL, getApplicationContext());
        }

        String printIP = FreeApi_SharePreferencesUtils.getSharePre("URL_FILE", "PRINT_IP", getApplicationContext());
        if (printIP.length() > 0) {
            Constant.PRINT_IP = printIP;
        } else {
            FreeApi_SharePreferencesUtils.setSharePre("URL_FILE", "PRINT_IP", Constant.PRINT_IP, getApplicationContext());
        }

        String printIP2 = FreeApi_SharePreferencesUtils.getSharePre("URL_FILE", "PRINT_IP2", getApplicationContext());
        if (printIP2.length() > 0) {
            Constant.PRINT_IP2 = printIP2;
        } else {
            FreeApi_SharePreferencesUtils.setSharePre("URL_FILE", "PRINT_IP2", Constant.PRINT_IP2, getApplicationContext());
        }
    }
}
